package mapping

import (
	"ota/model"
	"ota/model/entity"
)

// UserUpgradesEntityToDto entity data transfer
func UserUpgradesEntityToDto(userUpgrades []*entity.UserUpgrade) []*model.UserUpgradeInfo {
	out := make([]*model.UserUpgradeInfo, 0, len(userUpgrades))
	for _, c := range userUpgrades {
		out = append(out, UserUpgradeEntityToDto(c))
	}
	return out
}

// UserUpgradeEntityToDto entity data transfer
func UserUpgradeEntityToDto(e *entity.UserUpgrade) *model.UserUpgradeInfo {
	return &model.UserUpgradeInfo{

		Id: e.Id,

		UserId: e.UserId,

		UserName: e.UserName,

		UserPhone: e.UserPhone,

		PlanId: e.PlanId,

		PlanName: e.PlanName,

		EbikeId: e.EbikeId,

		UpgradeStrategyID: e.StrategyId,

		EbikeName: e.EbikeName,

		EbikeSnCode: e.EbikeSnCode,

		EbikeTypeId: e.EbikeTypeId,

		EbikeTypeName: e.EbikeTypeName,

		Detail: e.Detail,

		Progress: e.Progress,

		Status: e.Status,

		StatusDetail: e.StatusDetail,

		UpgradingStatus: e.UpgradingStatus,

		FailureReason: e.FailureReason,

		FailureLatestTime: e.FailureLatestTime,

		RetryCount: e.RetryCount,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
